﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using Model;

namespace BLL
{
    public class DepartmentBLL
    {
        DepartmentDAL dal = new DepartmentDAL();

        /// <summary>
        /// 显示部门
        /// </summary>
        /// <returns></returns>
        public List<Department> ShowDepartment()
        {
            return dal.Show();
        }

        public List<Department> PaperDepartment(int PageIndex, int PageSize, out int PageCount)
        {
            PageCount = dal.Show().Count();
            return dal.Show().Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList();
        }
        /// <summary>
        /// 添加部门
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public bool AddDepartment(Department m)
        {
            return dal.Add(m);
        }

        /// <summary>
        /// 删除部门
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public bool DelDepartment(Department m)
        {
            return dal.Del(m);
        }

        /// <summary>
        /// 查询单个部门信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Department BackDepartment(int id)
        {
            return dal.Back(id);
        }

        /// <summary>
        /// 修改部门信息
        /// </summary>
        /// <param name="m"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool UpdDepartment(Department m, int id)
        {
            return dal.Update(m, id);
        }
    }
}
